#pragma once
#include<iostream>
#include<string>

#define INFO 1
#define WARING 2
#define ERROR 3
#define DEBUG 4
#define FATAL 5

#define SIZE 1024

#define LOG(LEVEL,MESSAGE) log(#LEVEL,MESSAGE,__FILE__,__LINE__)

void log(std::string level,std::string message,std::string file,int line)
{
     time_t t = time(nullptr);
    struct tm* ptime = localtime(&t);
    char leftbuffer[SIZE];
    snprintf(leftbuffer,SIZE,"[%s]:[%d-%d-%d %d:%d:%d]",level.c_str(),ptime->tm_year + 1900,
    ptime->tm_mon + 1,ptime->tm_mday,ptime->tm_hour,ptime->tm_min,ptime->tm_sec);
    std::cout << leftbuffer << "[" << message << "]" << "[" << file << "]" << "[" << line << "]" << std::endl;
}